//
//  ViewController.m
//  sqlite
//
//  Created by 崔博 on 2018/9/21.
//  Copyright © 2018年 崔博. All rights reserved.
//  数据库

/*
 
 1 sql 增删改查
 .help
 .table 看数据的表
 .schema 看表的结构
 
 
 
 1. 创建表
 CREATE TABLE IF NOT EXISTS testtable (first_col integer); 不区分大小写
 
 2. insert into testtable values  (1); 插入数据
 
 3.select *from testtable; 查询
 
 结束排序
 order by (id+0转化id格式进行排序)
 select *from testtable order by id
 select *from testtable order by id id+0
 select *from testtable order by id id+0 desc
 select *from testtable order by id id+0 desc limit 1 限制条数
 seleted max(id+0) from testtable; 获取最大的id
 
 分页
 第一页：select *from testtable order by id id+0 limit 3;
 后面：select *from testtable where id+0 > 3 order by id id+0 limit 3; 条件语句
 
 表中有表
 select *from (seleted *from testtable where id+0 > 7) order by id+0 limit 3;
 
 匹配查找
 select *from testtable where name like '%c1%';
 
 基本运算
 select avg(id+0) from testtable;
 xxxxxx sum(id+0) xxxxxxxxxxxxxxx;
 xxxxxx min(id+0) xxxxxxxxxxxxxxx;
 xxxxxx max(id+0) xxxxxxxxxxxxxxx;
 
 4.删除
 delete from testtable where id = 3;
 5.更新
 update testtable set name ='1' where id = 3;
 6.表格增加字段
 alter table testtable add column age char;
 alter table testtable add column grade char default '1'; 设置默认值
 drop table testtable; // 删除表
 
 primary key 主键 一个表只有一个
 */

#import "ViewController.h"
#import "SQLClass.h"
@interface ViewController ()

@end




@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [SQLClass creatDBFile];
    [SQLClass creatDBfileSQL];
    [SQLClass creatTableName:@"bb"];
}


@end
